package com.sciai.utils;


import org.apache.tomcat.util.codec.binary.Base64;

/**
 * TODO lb <类名>
 *
 * @author tqx
 * @version 1.0.0.0
 * <p>Title: imageUtile </p >
 * <p>Description: TODO tqx </p >
 * Package: cn.lqdev.learning.springboot.chapter19.until
 * Company: 沪渝研究院
 * Copyright: Copyright(c) AI+X
 * Date: 2023年04月03日 16:39
 */
public class imageUtile {
    // 二进制转换成base64字符串
    public static String byteArr2String(byte[] byteArr) throws Exception {
        String stringBase64 = null;
        try {
            Base64 encoder = new Base64();
            stringBase64 = (byteArr != null ? encoder.encodeToString(byteArr) : "");
        } catch (Exception e) {
            throw new Exception("byteArr2String转换异常:" + e);
        }
        return stringBase64;
    }

}
